package com.atguigu.gulimall.product.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement// 开启事务管理
@MapperScan("com.atguigu.gulimall.product.dao")
public class MyBatisConfig {

    @Bean
    public PaginationInterceptor paginationInterceptor(){
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        // 如果传入的页数大于  最大页，那么就会跳入首页
        paginationInterceptor.setOverflow(true);
        // 设置每页最大条数
        paginationInterceptor.setLimit(1000);
        return paginationInterceptor;
    }
}
